import {mapGetters} from 'vuex'
export default {
    methods:{
      setBadge() {
        uni.setTabBarBadge({
          index: 2,
          text: this.total + ''
        })
      }
    },
    computed: {
      ...mapGetters('m_cart',['total'])
    },
    //使购物车数量随着商品增加而增加
    watch: {
      total(newValue) {
        this.setBadge()
      }
    },
    onShow() {
      this.setBadge()
    }
}